<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html >
<html>
<head>
<script type="text/javascript">


	//导出订单
	function exportExcel(){  
		var startTime = document.getElementById("searchCompany_startTime").value;
		var endTime =document.getElementById("searchCompany_endTime").value;
		var netsiteName =document.getElementById("searchCompany_netsiteName").value;
	     location.href="<%=basePath%>exportOrdersAction?netsiteName="+netsiteName+"&startTime="+startTime+"&endTime="+endTime;   
	} 
	
	function newUserOrder(){  
		var startTime = document.getElementById("searchCompany_startTime").value;
		var endTime =document.getElementById("searchCompany_endTime").value;
		var netsiteName =document.getElementById("searchCompany_netsiteName").value;
		if(startTime==""||endTime==""){
			alert("请选择时间！");
			return;
		}
		var flag="newUserOrder";
		location.href="<%=basePath%>exportOrdersAction?netsiteName="+netsiteName+"&startTime="+startTime+"&endTime="+endTime+"&flag="+flag;

	 } 

	/**查找带回机构信息*/
	function lookUpNetsite() {
		$.pdialog.open('orderNetsiteLookUp', 'organization', '网点信息', {
			width : 1000,
			height : 580,
			mask : true
		});
	}
		
	function emptydata()
	{
		document.getElementById("searchCompany_netsiteName").value="";
		document.getElementById("searchCompany_startTime").value="";
		document.getElementById("searchCompany_endTime").value="";
		document.getElementById("netSiteId_Search").value="";
		document.getElementById("netSiteId_Search1").value="";
		document.getElementById("courierId_Search").value="";
		document.getElementById("courierId_Search1").value="";
		document.getElementById("courierName_Search").value="";
	}
	
</script>
</head>
<c:if test="${code==1}">
	<script type="text/javascript">
		
	</script>
	<body>
		<div id="searchOrders_div_interval"></div>

		<div id="outside_div">


			<form id="pagerForm"  method="post"
				action="companyOrdersAction.action?toResult=searchCompanyOrders&rightId=${rightId}">
				<input type="hidden" name="pageNum" value="${page.currentPage }" />
				<input type="hidden" name="pageSize" value="${page.pageSize }" />
				<input type="hidden" id="pagerForm_startTime" name="startTime" value="${startDate}" />
				<input type="hidden" id="pagerForm_endTime" name="endTime" value="${endTime}" />
				<input type="hidden" id="searchCompany_netsiteName1" name="netSiteName" value="${netsiteName}" />
				<input type="hidden" id="courierId_Search1" name="courierId" value="${courierId}" />
				<input type="hidden" id="courierName_Search1" name="courierName" value="${courierName}" />
				<input type="hidden" id="netSiteId_Search1" name="netSiteId" value="${netSiteId}" />
				<input type="hidden" id="flagId" name="flag" value="${flag}" />
			</form>

			<form id="searchOrders_search" onsubmit="return navTabSearch(this);"
				action="companyOrdersAction.action?toResult=searchCompanyOrders&rightId=${rightId}"
				method="post">
				<div class="pageHeader">
					<input type="hidden" name="init" value=0>
					<div class="searchBar">
						<table class="searchContent">
							
							<tr>

								<td>快递公司网点：</td>
								<td>
									<a class="btnLook"	href="orderNetsiteLookUp" warn="请选择网点" lookupGroup="Netsite" width="1000" height="580">查找带回</a>
									<input id="netSiteId_Search"  bringBackName="Netsite.netSiteId" value="${netSiteId}" type="hidden" name="netSiteId"/> 
									<input	id="searchCompany_netsiteName"  bringBackName="Netsite.netSiteName" type="text"   lookupGroup="Netsite" name="netSiteName" value="${netSiteName}" size="40" readonly="readonly"/>
									</td>
								
								<td>开始时间: 
								<input id="searchCompany_startTime" type="text" class="date" name="startTime" value="${startDate}"
									readonly="readonly" />
								</td>				

								<td>结束时间: <input id="searchCompany_endTime" type="text" class="date" name="endTime" value="${endTime}"
									readonly="readonly" />
								</td>
								<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
								
							</tr>
							<tr>
								<td>
									

								
									<div class="buttonActive">
										<div class="buttonContent">
											<button type="button" onclick="emptydata()">清空</button>
										</div>
									</div>	
																
									<div class="buttonActive">
										<div class="buttonContent">
											<button type="submit">检索</button>
										</div>
									</div>
								</td>
							</tr>
							
						</table>
					</div>
				</div>
				<div class="pageContent">
					<div class="panelBar">
						<ul class="toolBar">
							<%-- <c:forEach items="${righSubtList}" var="rightsub">
								<c:if test="${fn:contains(rightsub.rightValue,'ss')}">
									<li>
									<button type="button" onclick="exportExcel" value="导出订单"></button>
									</li>
									<li class="line">line</li>
								</c:if>
							</c:forEach> --%>
							<button type="button" onclick="exportExcel()">导出订单</button>	
							<button type="button" onclick="newUserOrder()">导出新用户订单</button>
<!-- 							<button type="button" onclick="exportExcelOrderByUserId()">按UserId排序导出订单</button>	
							<button type="button" onclick="exportExcelOrderForDayAndUserId()">导出每天用户单一订单</button>	 -->						
						</ul>
					</div>
					<table id="companyOrders" class="list" width="100%" layoutH="138">
						<thead>
							<tr>
								<th align="center">序号</th>
								<th align="center">用户名</th>
								<th align="center">寄件人姓名</th>
								<th align="center">订单状态</th>
								<th align="center">快递网点</th>
								<th align="center">快递员</th>
								<th align="center">寄件地址</th>
								<th align="center">生成时间</th>
								<!-- <th align="center">备注</th> -->
							</tr>
						</thead>
						<tbody>
							<s:iterator var="orders" value="page.data" status="st">
								<tr target="sid_support" rel="<s:property value="#orders.id" />">
									<th width="1%" align="center"><s:property
											value="page.pageSize * (page.currentPage-1) + #st.index + 1" /></th>
									<th width="3%" align="left"><s:property
											value="#orders.username" /></th>
									<th width="3%" align="left"><s:property
											value="#orders.senderName" /></th>
									<th width="4%" align="left"><s:if
											test="#orders.orderStatus=='NOT_ASSIGNED'">
											<span style="color: blue">等待接单</span>
										</s:if> <s:elseif
											test="#orders.orderStatus=='NETSITE_CANCELLED_NOTINAREA'">
											<span style="color: purple">不在范围</span>
										</s:elseif> <s:elseif
											test="#orders.orderStatus=='NETSITE_CANCELLED_MENDACIOUS'">
											<span style="color: grey">虚假订单</span>
										</s:elseif> <s:elseif test="#orders.orderStatus=='ACCEPTED'">
											<span style="color: RosyBrown">等待取件_未打印</span>
										</s:elseif> <s:elseif test="#orders.orderStatus=='ACCEPTED_PRINTED'">
											<span style="color: brown">等待取件_已打印</span>
										</s:elseif> <s:elseif test="#orders.orderStatus=='PICKED'">
											<span style="color: DarkOrchid">取件成功_未录入</span>
										</s:elseif> <s:elseif test="#orders.orderStatus=='PICKED_INPUT'">
											<span style="color: green">取件成功_已录入</span>
										</s:elseif><s:elseif test="#orders.orderStatus=='CANCELLED'">
											<span style="color: red">订单取消</span>
										</s:elseif></th>
									<%-- <th width="3%" align="left"><s:property value="#orders.courierName" /></th>
						<th width="4%" align="left"><s:property value="#orders.expressOrderNo" /></th>--%>
									<th width="7%" align="left"><s:if
											test="#orders.netsiteName==null">
											<span style="color: red">待分配网点</span>
										</s:if> <s:elseif test="#orders.netsiteName!=null">
											<s:property value="#orders.netsiteName" />
										</s:elseif></th>
									<th width="3%" align="left"><s:property
											value="#orders.courierName" /></th>	
										
									<th width="11%" align="left"><s:property
											value="#orders.fromProvinceName" /> <s:property
											value="#orders.fromCityName" /> <s:property
											value="#orders.fromDistrictName" /> <s:property
											value="#orders.fromAddress" /></th>
									<th width="5%" align="center"><s:date
											name='#orders.xdDate' format='yyyy-MM-dd HH:mm:ss' /></th>
									<%-- <th width="5%" align="left"><s:property value="#orders.content" /></th> --%>
								</tr>
							</s:iterator>
						</tbody>
					</table>
					<div class="panelBar">
						<div class="pages">
							<span>共${page.totalNum }条，共${page.totalPage }页</span>
						</div>
						<div class="pagination" targetType="navTab"
							totalCount="${page.totalNum }" numPerPage="${page.pageSize }"
							pageNumShown="10" currentPage="${page.currentPage }"></div>
					</div>
				</div>
			</form>


		</div>
	</body>
</c:if>
<c:if test="${code==0}">
${message}
</c:if>
</html>